package com.ls.socketio.repository.dao;

import com.ls.socketio.bean.RoomBoxInfo;
import com.ls.socketio.repository.RoomBoxRepository;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author liShan
 * @date 2019/9/6 0:21
 */
@Component
public class RoomBoxRepositoryImpl {

    @Resource
    private RoomBoxRepository roomBoxRepository;

    /**
     * 保存
     * @param boxInfo 盒子信息
     */
    public void add(RoomBoxInfo boxInfo){
        roomBoxRepository.saveAndFlush(boxInfo);
    }

    /**
     * 根据房间id查询
     * @param roomId 房间id
     * @return 查询结果
     */
    public RoomBoxInfo findByRoomId(Long roomId){
        return roomBoxRepository.findByRoomId(roomId);
    }

}
